<!DOCTYPE html>
<html>
<head>
<include file="Public:header" />
<!-- jqgrid-->
<link href="__ACSS__/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox ">
                    <div class="ibox-content">
                        <div class="jqGrid_wrapper">
                            <table id="table_list"></table>
                            <div id="pager_list"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<!-- 全局js -->
<include file="Public:foot" />
<!-- jqGrid -->
<script src="__AJSPLUGINS__/jqgrid/i18n/grid.locale-cn.js?0820"></script>
<script src="__AJSPLUGINS__/jqgrid/jquery.jqGrid.min.js?0820"></script>
<!-- Page-Level Scripts -->
<script>
$(document).ready(function () {
	//初始化
    $.jgrid.defaults.styleUI = 'Bootstrap';
    $("#table_list").jqGrid({
    	url : '__URL__/getAllData',
    	datatype: "json",
        height: 580,
        autowidth: true,
        shrinkToFit: true,
        rowNum: 15,
        rowList: [10, 15, 30, 50],
        colNames: ['ID', '用户名', '反馈内容', '回复内容', '反馈时间', '操作'],
        colModel: [ {name : 'id',index : 'id'},
                    {name : 'username',index : 'username'},
                    {name : 'content',index : 'content'},
                    {name : 'feedback',index : 'feedback'},
                    {name : 'create_time',index : 'create_time',formatter: 'date',formatoptions: {srcformat:'u',newformat:'Y-m-d H:i:s'}},
                    {name : 'feedback',index : 'feedback',formatter : function(cellvalue, options, rowObject){
                   		if(cellvalue == null || cellvalue == "") {
                      		 content = '<button class="btn btn-white btn-xs btn-outline" onclick="feedback('+ rowObject.id +')"><i class="fa fa-comment-o"></i>  回复</button>';
                      	}else {
                      		 content = '已回复';
                      	}
                   	 	return content;
              	 		}}
        		],
        pager: "#pager_list",
        viewrecords: true,
        hidegrid: false,
        sortname: "feedback",
        sortorder: "asc",
    });

 	// 设置按钮
    $("#table_list").jqGrid('navGrid', '#pager_list', {
        edit: false,
        add: false,
        del: false,
        search: false
    }, {
        height: 200,
        reloadAfterSubmit: true
    });
    // 添加适配响应
    $(window).bind('resize', function () {
        var width = $('.jqGrid_wrapper').width();
        $('#table_list').setGridWidth(width);
    });
    
});
function feedback(id){
	layerDialog("回复",'__URL__/feedback?id='+id,"90%","450px",true);
}
</script>
</html>